home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / PRIcon.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.0 KB  |  113 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                PRIcon.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef PRICON_H
  11. #define PRICON_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #ifndef SLGRDEF_H
  18. #include "SLGrDef.h"
  19. #endif
  20.  
  21. #ifndef SLPTRECT_H
  22. #include "SLPtRect.h"
  23. #endif
  24.  
  25. #ifndef PRGRREF_H
  26. #include "PRGrRef.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class FW_OResourceFile;
  34.  
  35. class FW_CReadableStream;
  36. class FW_CWritableStream;
  37.  
  38. struct FW_SGraphicContext;
  39.  
  40. //========================================================================================
  41. //    class FW_CPrivIconRep
  42. //========================================================================================
  43.  
  44. class FW_CPrivIconRep : public FW_CPrivGrRefObj
  45. {
  46. public:
  47.     FW_DECLARE_AUTO(FW_CPrivIconRep)
  48.  
  49. //----------------------------------------------------------------------------------------
  50. //    Constructors/Destructors
  51. //
  52. public:
  53.                             FW_CPrivIconRep(FW_PlatformIcon platformIcon);
  54.                             FW_CPrivIconRep(FW_OResourceFile* resourceFile,
  55.                                         FW_ResourceID resID,
  56.                                         short size);
  57.  
  58.                             FW_CPrivIconRep(const FW_CPrivIconRep& rep);
  59.  
  60.                             ~FW_CPrivIconRep();
  61.  
  62. //----------------------------------------------------------------------------------------
  63. //    New API
  64. //
  65. public:
  66.     // ----- Streaming -----
  67.     
  68.                             FW_CPrivIconRep(FW_CReadableStream& stream);
  69.     void                    Write(FW_CWritableStream& stream) const;
  70.     
  71.     FW_Boolean                IsEqual(const FW_CPrivIconRep* other) const;
  72.  
  73.     // ----- Get, Set, Adopt and Orphan -----
  74.     
  75.     FW_PlatformIcon        GetPlatformIcon() const;
  76.     FW_PlatformIcon        OrphanPlatformIcon();
  77.     FW_Boolean            IsPlatformIconOrphan() const;
  78.     
  79.     void                SetPlatformIcon(FW_PlatformIcon newIcon);
  80.     void                AdoptPlatformIcon(FW_PlatformIcon newIcon);
  81.     
  82.     // ---- Geometry -----
  83.     void                GetIconSize(FW_SPoint& size) const;                            // Size in pixels
  84.     void                GetIconSize(Environment* ev, 
  85.                             FW_SGraphicContext& gc,
  86.                             FW_SPoint& size) const;                        // Size in gc units
  87.  
  88. //----------------------------------------------------------------------------------------
  89. //    Implementation
  90. //
  91. protected:
  92.     void                    DisposePlatformIcon();
  93.  
  94.     static FW_PlatformIcon    CopyPlatformIcon(FW_PlatformIcon icon);
  95.     static short            GetPlatformIconSize(FW_PlatformIcon icon);
  96.  
  97. private:
  98.     FW_Boolean            fOwnIcon;
  99.     FW_PlatformIcon        fPlatformIcon;
  100.     short                fMaxIconSize;
  101. };
  102.  
  103. //----------------------------------------------------------------------------------------
  104. //    FW_CPrivIconRep::GetPlatformIcon
  105. //----------------------------------------------------------------------------------------
  106.  
  107. inline FW_PlatformIcon FW_CPrivIconRep::GetPlatformIcon() const
  108. {
  109.     return fPlatformIcon;
  110. }
  111.  
  112. #endif // PRICON_H
  113.